/*****************************************************************************************
Arise Engine		importASE.h

					E-mail:		arise_engine@mail.ru

					Origin by:	Ascii File Importer by Christer Janson,
								Kinetix Development
								March 19, 1997 CCJ Initial coding

created:			24.02.2007
last changes:		13.02.2008
*****************************************************************************************/
#pragma once

#include "..\scene_editor\EditorScene.h"
#include "..\scene_editor\RawMesh.h"
#include "..\engine\TextParser.h"
#include "..\scene\LightSource.h"


class ImportAse
{
private:

	TextParser		m_parser;
	EditorScene*	m_scene;
	bool			m_is_neg_scale;
	UINT			m_file_version;

	void ImportNodeTM(TransformationNode &transformation_node);
	BOOL ImportSceneParams();
	BOOL ImportMaterialList();
	void ImportMaterial(RawMaterial* material);
	BOOL ImportStandardMtl(RawMaterial* material);
	BOOL ImportMultiSubObjMtl(RawMaterial* material);
	EditorTextureData GetTexture();
	BOOL ImportBitmapTexture(EditorTextureData &texture_data);
	BOOL ImportGeomObject();
	BOOL ImportMesh(RawMesh &mesh);
	BOOL ImportVertexList(RawMesh &mesh);
	BOOL ImportMeshNormals(RawMesh &mesh);
	BOOL ImportFaceList(RawMesh &mesh);
	DWORD GetSmoothingGroups(TCHAR* smStr);
	BOOL ImportTVertexList(std::vector<edTVertex> &tex_vertex_list);
	BOOL ImportTFaceList(std::vector<edTVFace> &tex_face_list);
	BOOL ImportMappingChannel(RawMesh &mesh);
	BOOL ImportLight();
	void GetLightSettings(LightSource& light_source);
	void ApplyPhysicObjectProperties(std::string &name, PhysicShape &shape);

	void ImportShape();
	void ImportHelper();
	void ImportCamera();

public:
	ImportAse();
	virtual ~ImportAse();

	bool LoadFromFile(const std::string file_name, EditorScene* scene);
};



bool IsComparePrefix(std::string &name, const char* tag, bool is_cut_name = true);
bool IsCompareAnyPrefix(std::string &name);
void CutAllPrefixes(std::string &name);
__int16 GetParentTypeByPrefix(std::string &name);
void TransferYZ(D3DXVECTOR3 &vector);